<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <my-com v-if="isShow" ref="mycom1" :prop1="p"></my-com>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>

        var vm = new Vue({
            el: '#app',
            data: {
                p: 'abc',
                isShow: true
            },
            components: {
                'MyCom' :{
                    template: `<div> 子组件：
                        内容是:{{message}} ：prop: {{prop1}}
                    </div>`,
                    props:['prop1'],
                    data() {
                        return {
                            message: 'abc'
                        }
                    },
                    beforeCreate: function () {
                        console.info('MyCom------beforeCreate 销毁前状态------');
                    },
                    created: function () {
                        console.info('MyCom------created创建完毕状态------');
                    
                    },
                    beforeMount: function () {
                        console.info('MyCom------beforeMount挂载前状态------');
                    },
                    mounted: function () {
                        console.info('MyCom------mounted 挂载结束状态------');
                    
                    },
                    beforeUpdate: function () {
                        console.info('MyCom---beforeUpdate 更新前状态===============》');
                    
                    },
                    updated: function () {
                        console.info('MyCom---updated 更新完成状态===============》');
                    
                    },
                    beforeDestroy: function () {
                        console.info('MyCom---beforeDestroy 销毁前状态===============》');
                    
                    },
                    destroyed: function () {
                        console.info('MyCom---destroyed 销毁完成状态===============》');
                    }
                }
            },
            beforeCreate: function () {
                console.group('------beforeCreate创建前状态------');
                console.groupEnd('------beforeCreate创建前状态------');
            },
            created: function () {
                console.group('------created创建完毕状态------');
                console.groupEnd('------created创建完毕状态------');
            },
            beforeMount: function () {
                console.info('------beforeMount挂载前状态------');
              
            },
            mounted: function () {
                console.info('------mounted 挂载结束状态------');
              
            },
            beforeUpdate: function () {
                console.info('beforeUpdate 更新前状态===============》');
              
            },
            updated: function () {
                console.info('updated 更新完成状态===============》');
              
            },
            beforeDestroy: function () {
                console.info('beforeDestroy 销毁前状态===============》');
              
            },
            destroyed: function () {
                console.info('destroyed 销毁完成状态===============》');
            }
        })
    </script>
</body>

</html>